package javaDesignModel.simpleFactoryPattern;

/**
 * Created by admin on 2017/3/13.
 */
public class Factory {
    public static Product getProduct(String args) throws UnSupportedShapeException {
        Product p = null;
        if (args.equalsIgnoreCase("A")) {
            p = new ProductA();
        } else if (args.equalsIgnoreCase("B")) {
            p = new ProductB();
        }else{
            throw new UnSupportedShapeException("类型不符合要求");
        }
        return p;
    }
}
